#ifndef SUBCALLBACK_H
#define SUBCALLBACK_H
#include <iostream>
#include "iaction_listener.h"
#include "actionlisten.h"
#include "async_client.h"
#include "connect_options.h"
#include "callback.h"
#include "delivery_token.h"
#include "message.h"
#if 0
class SubCallBack :
        public virtual mqtt::callback,
        public virtual mqtt::iaction_listener
{
public:
    SubCallBack(mqtt::async_client& cli, mqtt::connect_options& connOpts);

    void reconnect();

    // Re-connection failure
    void on_failure(const mqtt::token& tok) override;

    // (Re)connection success
    // Either this or connected() can be used for callbacks.
    void on_success(const mqtt::token& tok) override;

    // (Re)connection success
    void connected(const std::string& cause) override;

    // Callback for when the connection is lost.
    // This will initiate the attempt to manually reconnect.
    void connection_lost(const std::string& cause) override;

    // Callback for when a message arrives.
    void message_arrived(mqtt::const_message_ptr msg) override;

    void delivery_complete(mqtt::delivery_token_ptr token) override;

private:
    // Counter for the number of connection retries
    int m_nretry;

    // The MQTT client
    mqtt::async_client& cli_;

    // Options to use if we need to reconnect
    mqtt::connect_options& connOpts_;

    // An action listener to display the result of actions.
    ActionListen subListener_;
};

#endif

#endif // SUBCALLBACK_H
